import { AuthGuard, ReplaceableComponents, ReplaceableRouteContainerComponent } from '@abp/ng.core';
import { NgModule } from '@angular/core';
import { RouterModule, Routes } from '@angular/router';
import { Test1Component } from './home/test1/test1.component';
import { Test2Component } from './home/test2/test2.component';
import { Test3Component } from './home/test3/test3.component';
import { Test4Component } from './home/test4/test4.component';
import { Test5Component } from './home/test5/test5.component';
//import { CreateDetailRouteTabStategy } from './detail-route-tab-stategy';

const routes: Routes = [
  {
    path: '',
    pathMatch: 'full',
    loadChildren: () => import('./home/home.module').then(m => m.HomeModule),
  },
  {
    path: 'account',
    loadChildren: () => import('./joy-abpui-angular').then(m => m.AccountModule),
  },
  {
    path: 'identity',
    loadChildren: () => import('./joy-abpui-angular').then(m => m.IdentityModule),
  },
  {
    path: 'tenant-management',
    loadChildren: () => import('./joy-abpui-angular').then(m => m.TenantManagementModule),
  },
  {
    path: 'setting-management',
    loadChildren: () => import('./joy-abpui-angular').then(m => m.SettingManagementModule),
  },
  {
    path: 'menu1',
    component: ReplaceableRouteContainerComponent,
    canActivate: [AuthGuard],
    data: {
      replaceableComponent: {
        key: 'eAccountComponents.menu1',
        defaultComponent: Test1Component,
      } as ReplaceableComponents.RouteData<Test1Component>,
    },
  },
  {
    path: 'home/menu2',
    component: ReplaceableRouteContainerComponent,
    canActivate: [AuthGuard],
    data: {
      replaceableComponent: {
        key: 'eAccountComponents.menu2',
        defaultComponent: Test2Component,
      } as ReplaceableComponents.RouteData<Test2Component>,
    },
  },
  {
    path: 'test/menu3',
    canActivate: [AuthGuard],
    component: ReplaceableRouteContainerComponent,
    data: {
      replaceableComponent: {
        key: 'eAccountComponents.menu3',
        defaultComponent: Test3Component,
      } as ReplaceableComponents.RouteData<Test3Component>,
    },
  },
  {
    path: 'test/menu4',
    canActivate: [AuthGuard],
    component: ReplaceableRouteContainerComponent,
    data: {
      replaceableComponent: {
        key: 'eAccountComponents.menu3',
        defaultComponent: Test4Component,
      } as ReplaceableComponents.RouteData<Test4Component>,
    },
  },
  {
    path: 'test/menu5/:id',
    canActivate: [AuthGuard],
    component: ReplaceableRouteContainerComponent,
    data: {
      replaceableComponent: {
        key: 'eAccountComponents.menu3',
        defaultComponent: Test5Component,
      } as ReplaceableComponents.RouteData<Test5Component>,
      //createRouteTabStategy: CreateDetailRouteTabStategy,
    },
  },
];

@NgModule({
  imports: [RouterModule.forRoot(routes, { relativeLinkResolution: 'legacy' })],
  exports: [RouterModule],
})
export class AppRoutingModule {}
